package com.marathon.ershor.textrecognizer;

import android.content.Context;

import com.sogou.tts.offline.TTSPlayer;
import com.sogou.tts.offline.listener.TTSPlayerListener;
import com.sogou.tts.offline.setting.ToneSettings;

/**
 * Created by liuyan on 2017/8/19.
 */

public class TTSWrapper implements TTSPlayerListener {
    private static TTSWrapper instance;
    public static TTSWrapper getInstance(Context context) {
        if (instance == null)
            instance = new TTSWrapper(context);
        return  instance;
    }

    private TTSPlayer player;
    TTSWrapper(Context context) {
        System.loadLibrary("ttsoff");

        player = new TTSPlayer();
        player.init(context, this);
        player.addSndModel(context, "", ToneSettings.TONE_ZSH);
    }

    public void play(String str) {
        player.play(str, str);
    }

    ////////////////
    @Override
    public void onComplete() {

    }

    @Override
    public void onStart() {

    }

    @Override
    public void onSpeakProgress(Float aFloat) {

    }

    @Override
    public void onSegSyn(String[] strings, float[] floats, byte[] bytes) {

    }

    @Override
    public void onEnd(String s) {

    }

    @Override
    public void onError(int i) {

    }

    @Override
    public void onPause() {

    }

    @Override
    public void onResume() {

    }

    @Override
    public void onSynEnd(Float aFloat) {

    }
}
